#ifndef _OLED_H

#define _OLED_H

#include "stdio.h"
#include "stm32f10x.h"
#include "stm32f10x_usart.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_spi.h"
#include "OLED_DATA.h"
//extern uint8_t OLED_F8x16[][16];

#define OLED_SCK_PORT 			GPIOA
#define OLED_SCK_PIN 			GPIO_Pin_5
#define OLED_SCK_CLK         	RCC_APB2Periph_GPIOA

#define OLED_MOSI_PORT 			GPIOA
#define OLED_MOSI_PIN 			GPIO_Pin_7
#define OLED_MOSI_CLK         	RCC_APB2Periph_GPIOA

#define OLED_CS_PORT 			GPIOC
#define OLED_CS_PIN 			GPIO_Pin_13
#define OLED_CS_CLK         	RCC_APB2Periph_GPIOC

#define OLED_DC_PORT 			GPIOC
#define OLED_DC_PIN 			GPIO_Pin_4
#define OLED_DC_CLK     		RCC_APB2Periph_GPIOC                                                         	

#define OLED_RES_PORT 			GPIOE
#define OLED_RES_PIN 			GPIO_Pin_5
#define OLED_RES_CLK         	RCC_APB2Periph_GPIOE



#define OLED_SPI_CLK			RCC_APB2Periph_SPI1

#define OLED_SPI       			SPI1

#define OLED_DC_Data  	    GPIO_SetBits(OLED_DC_PORT,OLED_DC_PIN);
#define OLED_DC_CMD   		GPIO_ResetBits(OLED_DC_PORT,OLED_DC_PIN);

#define OLED_CS_H 	   	 	GPIO_SetBits(OLED_CS_PORT,OLED_CS_PIN);
#define OLED_CS_L  			GPIO_ResetBits(OLED_CS_PORT,OLED_CS_PIN);

#define OLED_RES_H 	   	 	GPIO_SetBits(OLED_RES_PORT,OLED_RES_PIN);
#define OLED_RES_L  		GPIO_ResetBits(OLED_RES_PORT,OLED_RES_PIN);

enum SX
{
	YES = 1,
	NO = 0,
	
};
void OLED_WriteDATA(uint8_t Data);

void OLED_WriteCMD(uint8_t CMD);

void OLED_Init(void);
void OLED_Clear(void);
void OLED_SetCursor(uint8_t Y_Page,uint8_t X_Location);
void DrewACycle(uint8_t R , uint8_t SX , uint8_t PositionY,uint8_t PositionX);
#endif
